import {HTTP} from "../utils/http-p.js";

class BookModel extends HTTP {
    getHotLisr() {
        return this.request({url: 'book/hot_list'})
    }

    getMyBookCount() {
        return this.request({
            url: '/book/favor/count'
        })
    }

    search(q,start) {
        return this.request({
            url: '/book/search?summary=1',
            data: {
                q:q,
                start:start
            }
        })
    }

    getDetail(bid) {
        return this.request({
            url: `/book/${bid}/detail`
        })
    }

    getComment (bid) {
        return this.request({
            url: `/book/${bid}/short_comment`
        })
    }

    getLikeStatus(bid) {
        return this.request({
            url: `/book/${bid}/favor`
        })
    }

    addComment(bid,comment) {
        return this.request({
            url: '/book/add/short_comment',
            method: 'POST',
            data: {
                book_id: bid,
                content: comment
            }
        })
    }
}


export {BookModel}